<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<title>Log</title>
</head>
<body onload="startLog()" >

<div id="menu">
<a href="control.html" target="control">Control</a>
<a href="bus.html" target="bus">Bus</a>
<a href="plan.html" target="plan">Plan</a>
<a href="log.html" target="log" style="background:gray;">Log</a>
</div>

<textarea id="log" style="width: 100%; height: 95%;" readonly="true" ></textarea>

<script>
var startLog = function() {
	var ws = new WebSocket("ws://" + window.location.host + "/syslog");
	var log = document.getElementById('log');
	ws.onmessage = function (evt) { log.value += evt.data  };
	ws.onclose = function (evt) { log.value += "\n----------CLOSED------------\n"};
	ws.onerror = function (evt) { log.value += "\n----------ERROR:" + evt.data + "------------\n"};
}
</script>
</body>
</html>
